WARNING: Condition codes are inverted from how they are documented. To fix, connect 'w' of 74151 to the XOR, not 'y'. General Information: 800mA @ 5V (4W) in original TTL ?MHz clock speed in original TTL ?MHZ bus speed in original TTL 2-4 clock cycles per instruction 8-bit data bus 16-bit address buses 64KB program memory 32KB data memory One I/O port Modified Harvard Architecture 4 registers A arithmetic/flag swap register B arithmetic/index register C index register F flag register Instruction Format: {opcode[4:0], cc[2:0]} Instruction Set (v0.2): Op-code Assembly Clock cycles Description #00 NOP 2 No operation #01 LDI byte A 4 prog[pc+1] -> A #02 LDI byte B 4 prog[pc+1] -> B #03 LDI byte C 4 prog[pc+1] -> C #04 LDM A 4 data[C B] -> A #05 LDM B 4 data[C B] -> B #06 LDM C 4 data[C B] -> C #07 LDP A 4 prog[C B] -> A #08 LDP B 4 prog[C B] -> B #09 LDP C 4 prog[C B] -> C #0A STM A 4 A -> data[C B] #0B STP A 4 A -> prog[C B] #0C MOV A B 4 A -> B #0D MOV B A 4 B -> A #0E MOV A C 4 A -> C #0F MOV B C 4 B -> C #10 BR.cc 4 F[cc] ? [C B] : pc + 1 -> pc #80 BR.C 4 F[cc] = carry #81 BR.N 4 F[cc] = negative #82 BR.V 4 F[cc] = overflow #83 BR.NZ 4 F[cc] = not zero #84 BR.H 4 F[cc] = half carry #85 BR.E 4 F[cc] = even parity #86 BR.S 4 F[cc] = right-shift carry #87 BR.T/JMP 4 F[cc] = true #11 BR.ncc 4 !F[cc] ? [C B] : pc + 1 -> pc #88 BR.NC 4 F[cc] = no carry #89 BR.P/BR.NN 4 F[cc] = positive #8A BR.NV 4 F[cc] = no overflow #8B BR.Z 4 F[cc] = zero #8C BR.NH 4 F[cc] = no half carry #8D BR.D/BR.NE 4 F[cc] = odd parity #8E BR.NS 4 F[cc] = no right-shift carry #8F BR.F 4 F[cc] = false #12 SWF A 4 A -> F, F -> A #13 SHR A 4 A>>1 -> A #14 SHR B 4 A>>1 -> B #15 ADD A 4 A + B + carry -> A #16 ADD B 4 A + B + carry -> B #17 ADD C 4 A + B + carry -> C #18 SUB A 4 A - B - 1 + carry -> A #19 SUB B 4 B - A - 1 + carry -> B #1A AND A 4 A & B -> A #1B AND B 4 A & B -> B #1C OR A 4 A | B -> A #1D OR B 4 A | B -> B #1E XOR A 4 A ^ B -> A #1F XOR B 4 A ^ B -> B Flag Register Contents: bit symbol use --------------------------- 0 C Carry - Is set when a carry occurs or a borrow does not occur. 1 N Negative - Is set when the result of an operation is negative. N is an XOR of the sign of the result and the overflow flag (V). 2 V Overflow - Is set when the sign of the result is not correct. 3 !Z Not Zero - Is set when the result of the operation is not 0xFF. To compare two numbers, clear the carry flag and subtract A from B. 4 H Half Carry - Is set when a carry from the lower four bits occurs. This flag is used for BCD arithmetic. 5 E Even Parity - Is set when the parity is even. 6 S Right-Shift Carry - Is the lower bit of A before the carry occurred. 7 T True - Always high. Is used for jumps and two cycle nops. While this flag can be modified with the SWF instruction, a BR.cc instruction always reads T as true. Instructions that affect the flags: SWF A SHR A/B ADD A/B/C SUB A/B AND A/B OR A/B XOR A/B Computer Memory Map: Program memory _______________ #0000 |_______________| Reset/ROM #0001 | | ROM | | | | ~~~~~~~~~~~~~~~~~ | | | | #FFFF |_______________| Data memory _______________ #0000 | | RAM | | | | ~~~~~~~~~~~~~~~~~ | | | | |_______________| #1000 | | I/O port | | | | ~~~~~~~~~~~~~~~~~ | | | | #FFFF |_______________| Pseudo Instructions: name use .prog All code below this line will be put in program memory. .data All code below this line will be put in data memory. .addr address Sets the base address of the instructions that follow. .macro name Tells the assembler that the following code is a macro. .endmacro Tells the assembler that the end of the macro code has been reached. .const data Places a list of data in memory. data can be a comma separated list or a string.